/**
 *
 */
moduleMain.controller("DashboardLearningMapAnswerSheetInfo", function ($scope, $log, $state, GeneralResource, LoadingService, ConstantService, DialogService) {
    initPage($scope);
    $scope.$on("$viewContentLoaded", function () {
        $scope.reset();
        pageOnLoad($scope);
        $scope.currentState = $state.current;
        if ($scope.currentState.name === $state.current) {
            ConstantService.addState($state.current, true);
        }
        $scope.query(1);
    });

    $scope.reset = function () {
        $scope.queryPara = {
            className: Models.LearningMapAnswerSheet.className,
            query: {
                learningMapName: {
                    field: Models.LearningMapAnswerSheet.query.learningMapName
                },
                status: {
                    field: Models.LearningMapAnswerSheet.query.status.name,
                    enumClass: Models.LearningMapAnswerSheet.query.status.enumClass,
                    value: 'FINISH'
                }
            },
            orderBy: {
                name: {
                    field: Models.LearningMapAnswerSheet.query.createDate,
                    sortType: 'DESC'
                }
            }
        };
    }

    $scope.query = function (pageNo) {
        //LoadingService.show();
        GeneralResource.queryPage({pageNo: pageNo - 1, pageSize: 10}, $scope.queryPara, function (queryResult) {
            $log.debug("查询结果", queryResult.data);
            $scope.queryResult = queryResult.data;
            $scope.pagination.setPage(queryResult.data, pageNo);
            //LoadingService.hide();
        });
    };
    $scope.pagination = new Pagination();
    $scope.pagination.setPageClickFn($scope.query);
});
